﻿// owner 蒋家伟

#pragma once

// jsdk
#include "ISocketHardwareDevice.h"
#include "SocketHardwareCompoent.h"
#include "ISocketHardwareExternalData.h"

namespace jsdk
{
    class SocketHardwareDevice final : public ISocketHardwareDevice
    {
    public:
        static OwnerPtr<ISocketHardwareDevice> create(OwnerPtr<ISocketHardwareExternalData> opSocketHardwareExternalData);
        ~SocketHardwareDevice() {}

    private:
        // 继承IDevice
        virtual bool start() override;
        virtual void stop() override;
        virtual bool isOnline() const override;
        virtual void addTask(const TaskId& taskId) const override;
        virtual const std::wstring getDeviceName() const override;
        virtual const IDeviceExternalData* getExternalData() const override;
        virtual IDeviceExternalData* getExternalDataFW() override;

        // 继承ISocketHardwareDevice
        virtual void sendMessage(std::string&& msg, int64_t length) const override;
        virtual void reConnect() const override;
        // owner
        SocketHardwareDevice() {}

    private:
        OwnerPtr<SocketHardwareCompoent> m_opSocketHardwareCompoent;
        OwnerPtr<ISocketHardwareExternalData> m_opExternalData;
    };
}